package com.cmxh.cloundnote.service;

import com.cmxh.cloundnote.mapper.ArticleMapper;
import com.cmxh.cloundnote.pojo.Article;
import com.cmxh.cloundnote.util.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceimpl implements ArticleService{
    @Autowired
    private ArticleMapper articleMapper;
    @Override
    public PageInfo<Article> findAll(PageUtil pageUtil) {
        PageHelper.startPage(pageUtil.getPageNum(),pageUtil.getPageSize());
        Integer id = (Integer) pageUtil.getXx();

        List< Article> list = articleMapper.findAll(id);
        PageInfo<Article> xx = new PageInfo<>(list);
        return xx;
    }

    @Override
    public int deleted(Integer id) {
        return articleMapper.deleted(id);
    }
}
